﻿/*
 * KLF Headless Browser
 * Written by Kris Oye <kristianoye@gmail.com>
 * Copyright (C) 2011-2012.  All rights reserved.
 */
namespace KLF.Lib.Browser.DOM
{
    #region Using Statements

    using System;

    #endregion

    public class Entity : Node
    {
        #region DOM Level 1 Compliance

        public override Node cloneNode(bool deep)
        {
            return new Entity()
            {
                _entityName = this._entityName
            };
        }

        public override string nodeName
        {
            get { return _entityName.Value; }
        }
        internal StringLookup _entityName;

        public override string nodeValue
        {
            get { return null; }
        }

        public override byte nodeType
        {
            get { return ENTITY_NODE; }
        }

        #endregion

        #region DOM Level 3 Compliance

        /// <summary>
        /// An attribute specifying the encoding used for this entity at the
        /// time of parsing, when it is an external parsed entity. This is null
        /// if it an entity from the internal subset or if it is not known.
        /// </summary>
        public string inputEncoding
        {
            get
            {
                return _inputEncoding != null ? _inputEncoding.Value : null;
            }
            internal set
            {
                _inputEncoding = new StringLookup(value);
            }
        }
        internal StringLookup _inputEncoding;

        /// <summary>
        /// An attribute specifying, as part of the text declaration, the 
        /// encoding of this entity, when it is an external parsed entity. 
        /// This is null otherwise.
        /// </summary>
        public string xmlEncoding
        {
            get
            {
                return _xmlEncoding != null ? _xmlEncoding.Value : null;
            }
            internal set
            {
                _xmlEncoding = new StringLookup(value);
            }
        }
        internal StringLookup _xmlEncoding;

        /// <summary>
        /// An attribute specifying, as part of the text declaration, the 
        /// version number of this entity, when it is an external parsed 
        /// entity. This is null otherwise.
        /// </summary>
        public string xmlVersion
        {
            get
            {
                return _xmlVersion != null ? _xmlVersion.Value : null;
            }
            internal set
            {
                _xmlVersion = new StringLookup(value);
            }
        }
        internal StringLookup _xmlVersion;

        #endregion
    }
}
